package no.ntnu.fp.gui;

import java.awt.*;

import javax.swing.*;

import no.ntnu.fp.model.Message;

/**
 * Renderer for lista over meldinger i InboxPanel
 * @author jenz
 *
 */
public class InboxRenderer extends DefaultListCellRenderer {

	private Message message;
	
	public Component getListCellRendererComponent(JList list, Object value,
			int index, boolean isSelected, boolean cellHasFocus) {

			message = (Message)value;
		
			JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
			
			if ( message.isRead() == 0 ) label.setText(message.getSender()+ " (NEW)");
			else label.setText(message.getSender());
			return label;
		}

	
	
}
